/* Required Includes */
#import <Cocoa/Cocoa.h>
#import <OpenGL/gl.h>
#import <OpenGL/glext.h>
#import <OpenGL/glu.h>
#import <OpenGL/OpenGL.h>
#import <GLUT/glut.h>
#include "glut_teapot.h"
#include "mat4.h"

/* Parameter */
typedef struct _Parameter {
	float current [4];
	float min     [4];
	float max     [4];
	float delta   [4];
	
} Parameter;

/* Macros */
#define PARAMETER_CURRENT(p)    (p.current)
#define PARAMETER_ANIMATE(p)    ({ int i; for (i = 0; i < 4; i ++) { \
											p.current[i] += p.delta[i]; \
											if ((p.current[i] < p.min[i]) || (p.current[i] > p.max[i])) \
												p.delta[i] = -p.delta[i]; } } )
												
/* Exhibit base class */
@interface Exhibit : NSObject {
	BOOL initialised;
	GLhandleARB vertex_shader, fragment_shader, program_object;
	GLUquadric *quadric;
	BOOL gpuProcessingInit;
	BOOL gpuProcessing;
}

- (id) init;
- (void) initLazy;
- (void) dealloc;
- (NSString *) name;
- (NSString *) descriptionFilename;
- (unsigned int) loadVertexShader: (NSString *) vertexString fragmentShader: (NSString *) fragmentString;
- (void) renderFrame;
- (BOOL) reflect;

@end


// Utility Functions

int NextHighestPowerOf2(int n);
void CopyFramebufferToTexture(GLuint texture);
NSBitmapImageRep *LoadImage(NSString *path, int shouldFlipVertical);
